#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "SystemVal.h"

#include <QFile>
#include <QMainWindow>
#include <QMap>
#include <QSet>
#include <QStringListModel>
#include <QAbstractItemModel>
#include <QListWidgetItem>
#include "child/Details.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void initUI();
    void loadFromOri();

    DB_Keys getVaildKeys(DB_Types &db_tys);

    void appendBuf(QString);                 //! 添加到缓冲区
    void showDetails(int,QString seamname);     //! 显示详情
    void highLight(QStringList v);              //! 已经添加的高亮显示一下

    void appendLog(QString lo);
    void writeLogs(QString f);  //! 写曾经的query
    void writeErrorLog(QString f);

    void insertCads(QStringList,QSqlQuery query); //! 插入CAD数据

private slots:
    void on_tb_move2buf_clicked();

    void on_actionWrite_triggered();

    void on_tb_all_clicked();

    void on_list_W2_itemDoubleClicked(QListWidgetItem *item);

    void on_list_W1_doubleClicked(const QModelIndex &index);

    void on_tb_del_sel_clicked();

    void on_actionSame_triggered();

private:
    Ui::MainWindow *ui;

    DB_Keys cur_ValidKeys;
    DB_Types db_tys;    //! 存储当前填入类型
    QStringListModel *buf;  //! 左list数据


    QStringList out;

    QStringList errors;


    QStringList inserted_cadid;
};
#endif // MAINWINDOW_H
